package com.yanqu.road.entity.banquet.invitation;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Objects;

@FieldTypeAnnotation(tableName = "t_c_banquet_relation")
public class CrossPartyRelationData extends DataObject {
    @FieldTypeAnnotation(update = true)
    private long userId1;
    @FieldTypeAnnotation()
    private int joinTimes1;
    @FieldTypeAnnotation(update = true)
    private long userId2;
    @FieldTypeAnnotation()
    private int joinTimes2;
    @FieldTypeAnnotation(update = true)
    private int partyType;
    @FieldTypeAnnotation(select = true)
    private long lastJoinTime;

    public long getUserId1() {
        return userId1;
    }

    public void setUserId1(long userId1) {
        if (!Objects.equals(this.userId1, userId1)) {
            this.userId1 = userId1;
            setUpdateOption();
        }
    }

    public int getJoinTimes1() {
        return joinTimes1;
    }

    public void setJoinTimes1(int joinTimes1) {
        if (!Objects.equals(this.joinTimes1, joinTimes1)) {
            this.joinTimes1 = joinTimes1;
            setUpdateOption();
        }
    }

    public long getUserId2() {
        return userId2;
    }

    public void setUserId2(long userId2) {
        if (!Objects.equals(this.userId2, userId2)) {
            this.userId2 = userId2;
            setUpdateOption();
        }
    }

    public int getJoinTimes2() {
        return joinTimes2;
    }

    public void setJoinTimes2(int joinTimes2) {
        if (!Objects.equals(this.joinTimes2, joinTimes2)) {
            this.joinTimes2 = joinTimes2;
            setUpdateOption();
        }
    }

    public int getPartyType() {
        return partyType;
    }

    public void setPartyType(int partyType) {
        if (!Objects.equals(this.partyType, partyType)) {
            this.partyType = partyType;
            setUpdateOption();
        }
    }

    public long getLastJoinTime() {
        return lastJoinTime;
    }

    public void setLastJoinTime(long lastJoinTime) {
        if (!Objects.equals(this.lastJoinTime, lastJoinTime)) {
            this.lastJoinTime = lastJoinTime;
            setUpdateOption();
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CrossPartyRelationData data = (CrossPartyRelationData) o;
        return userId1 == data.userId1 &&
                userId2 == data.userId2 &&
                partyType == data.partyType;
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId1, userId2, partyType);
    }
}
